﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interfleet.SE.UICompiler.Core
{
    /// <summary>
    /// <para>
    /// This class contains the available options for a compile type.
    /// </para>
    /// <para>
    /// If there is any options available for a compile type, one of these options
    /// must be set on the CompileOption property of the <see cref="Arguments"/>
    /// </para>
    /// </summary>
    /// <see cref="CompileType"/>
    public abstract class CompileOptions
    {
        /// <summary>
        /// The available compile options
        /// </summary>
        public abstract string[] Options { get; }

        /// <summary>
        /// Use the corresponding option as default
        /// </summary>
        public virtual int PreselectedIndex
        {
            get { return 0; }
        }

        /// <summary>
        /// Will return the default (Options[PresselectedIndex] if there is one. Otherwise null.
        /// </summary>
        public string DefaultOption
        {
            get
            {
                if (Options != null && Options.Length > PreselectedIndex)
                {
                    return Options[PreselectedIndex];
                }
                return null;
            }
        }
    }
}
